{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "correct-vertex",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "  <meta charset=\"UTF-8\">\n",
       "  <title>PyG2Plot</title>\n",
       "</head>\n",
       "<body>\n",
       "  <style>\n",
       "    * {\n",
       "      margin: 0;\n",
       "      padding: 0;\n",
       "      box-sizing: border-box;\n",
       "    }\n",
       "    html, body, div.pyg2plot-plot-container { \n",
       "      height: 100%;\n",
       "      overflow: hidden;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "  <div id=\"bc6ad77b7bef42bdb7bca26aca4df65a\" class=\"pyg2plot-plot-container\"></div>\n",
       "\n",
       "  <script>\n",
       "    // load javascript\n",
       "    new Promise(function(resolve, reject) {\n",
       "      var script = document.createElement(\"script\");\n",
       "      script.onload = resolve;\n",
       "      script.onerror = reject;\n",
       "      script.src = \"https://unpkg.com/@antv/g2plot@2\";\n",
       "      document.head.appendChild(script);\n",
       "    }).then(() => {\n",
       "      var plot_bc6ad77b7bef42bdb7bca26aca4df65a = new G2Plot.Line(\"bc6ad77b7bef42bdb7bca26aca4df65a\", {\n",
       "  \"height\": 400,\n",
       "  \"data\": [\n",
       "    {\n",
       "      \"year\": \"1991\",\n",
       "      \"value\": 3\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1992\",\n",
       "      \"value\": 4\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1993\",\n",
       "      \"value\": 3.5\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1994\",\n",
       "      \"value\": 5\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1995\",\n",
       "      \"value\": 4.9\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1996\",\n",
       "      \"value\": 6\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1997\",\n",
       "      \"value\": 7\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1998\",\n",
       "      \"value\": 9\n",
       "    },\n",
       "    {\n",
       "      \"year\": \"1999\",\n",
       "      \"value\": 13\n",
       "    }\n",
       "  ],\n",
       "  \"xField\": \"year\",\n",
       "  \"yField\": \"value\"\n",
       "}); \n",
       "      plot_bc6ad77b7bef42bdb7bca26aca4df65a.render();\n",
       "    });\n",
       "  </script>\n",
       "</body>\n",
       "</html>"
      ],
      "text/plain": [
       "<pyg2plot.helper.html.HTML at 0x10fad2eb0>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyg2plot import Plot\n",
    "\n",
    "line = Plot(\"Line\")\n",
    "\n",
    "line.set_options({\n",
    "  \"height\": 400, # set a default height in jupyter preview\n",
    "  \"data\": [\n",
    "    { \"year\": \"1991\", \"value\": 3 },\n",
    "    { \"year\": \"1992\", \"value\": 4 },\n",
    "    { \"year\": \"1993\", \"value\": 3.5 },\n",
    "    { \"year\": \"1994\", \"value\": 5 },\n",
    "    { \"year\": \"1995\", \"value\": 4.9 },\n",
    "    { \"year\": \"1996\", \"value\": 6 },\n",
    "    { \"year\": \"1997\", \"value\": 7 },\n",
    "    { \"year\": \"1998\", \"value\": 9 },\n",
    "    { \"year\": \"1999\", \"value\": 13 },\n",
    "  ],\n",
    "  \"xField\": \"year\",\n",
    "  \"yField\": \"value\",\n",
    "})\n",
    "\n",
    "line.render_jupyter_lab()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
